<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>会议室设置</title>
	<link rel="stylesheet" href="/js/plugin/layui-v2.3.0/layui/css/layui.css">
	<link rel="stylesheet" href="/css/reset.css">
	<link rel="stylesheet" href="/css/index.css">
	<link rel="stylesheet" href="/css/project_set.css">
	<script src="/js/jquery-2.1.1.min.js"></script>
	<script src="/js/plugin/layui-v2.3.0/layui/layui.js"></script>
</head>
<script>
	$(document).ready(function() {
		$("#reserveStartDate").val($("#reserveStartDateId").val());
		$("#reserveEndDate").val($("#reserveEndDateId").val());
		
		renderForm();
		setHeight()
	});
	//重新渲染表单
	function renderForm(){
	    layui.use('form', function(){
	       var form = layui.form;//高版本建议把括号去掉，有的低版本，需要加()
	       form.render();
	    });
	}
</script>
<style>
	body,html{
		height: auto; 
	}
	.room-form .layui-select-title{/* 修改select样式 */
	    width: 116px;
	    height: 30px;
	}
	.room-form .layui-input{
	    height: 30px;
	}
</style>
<body>
<input type="hidden" id="reserveStartDateId" name="reserveStartDateId" th:value="${set.reserveStartDate}"/>
<input type="hidden" id="reserveEndDateId" name="reserveEndDateId" th:value="${set.reserveEndDate}"/>
	<div class="nav-section-content-container" style="padding: 0px">
					<header class="nav-header">
						<div class="nav-section-header-title">
							<span>会议室设置</span>
						</div>
					</header>
					<div class="kb-form-container" style="min-height:500px">
						<form class="layui-form" id="defaultForm" th:action="@{/app/projectSet/update}" th:method="post" lay-filter="employee-form">
							<input type="hidden" id="fkProject" name="fkProject" th:value="${set.fkProject}"/>
							<div>
								<div class="layui-form-item mag-bot-20">
									<div class="f-left">
										<div>提前多久通知</div><p class="color-nine">可以提前通知开会的小时数，默认值为1</p>
									</div>
									<div class="kb-number-input f-right">
										<div class="counterBox" style="margin-right: 130px;">
											<span class="subtracter">-</span><input type="number" name="noticeDate" id="noticeDate" th:value="${set.noticeDate}"><span class="summator">+</span>
										</div>
									</div>	
								</div>
								<div class="layui-form-item mag-bot-20">
									<div class="f-left">
										<div>可以提前多久取消预订</div><p class="color-nine">可以提前取消预订的小时数，默认值为0，会议开始后不能取消</p>
									</div>
									<div class="kb-number-input f-right">
										<div class="counterBox" style="margin-right: 130px;">
											<span class="subtracter">-</span><input type="number" name="cancel" id="cancel" th:value="${set.cancel}"><span class="summator">+</span>
										</div>
									</div>	
								</div>
								<div class="layui-form-item mag-bot-20">
									<div class="f-left">
										<div>预定会议室起止时间</div><p class="color-nine">可以设置会议室预定开始时间和结束时间</p>
									</div>
									<div class="f-right flex">
										<div class="layui-input-inline" style="width:120px">
										<select id="reserveStartDate" name="reserveStartDate" >
									       	<option value="8">08:00</option>
									        <option value="9">09:00</option>
									        <option value="10">10:00</option>
									        <option value="11">11:00</option>
									        <option value="12">12:00</option>
									        <option value="13">13:00</option>
									        <option value="14">14:00</option>
									        <option value="15">15:00</option>
									        <option value="16">16:00</option>
									        <option value="17">17:00</option>
									        <option value="18">18:00</option>
									        <option value="19">19:00</option>
									        <option value="20">20:00</option>
									        <option value="21">21:00</option>
									        <option value="22">22:00</option>
									        <option value="23">23:00</option>
									        <option value="24">24:00</option>
									    </select>
									    </div>
									    &nbsp;-&nbsp;
									    <div class="layui-input-inline" style="width:120px">
										<select id="reserveEndDate" name="reserveEndDate" >
									       <option value="8">08:00</option>
									        <option value="9">09:00</option>
									        <option value="10">10:00</option>
									        <option value="11">11:00</option>
									        <option value="12">12:00</option>
									        <option value="13">13:00</option>
									        <option value="14">14:00</option>
									        <option value="15">15:00</option>
									        <option value="16">16:00</option>
									        <option value="17">17:00</option>
									        <option value="18">18:00</option>
									        <option value="19">19:00</option>
									        <option value="20">20:00</option>
									        <option value="21">21:00</option>
									        <option value="22">22:00</option>
									        <option value="23">23:00</option>
									        <option value="24" selected="selected">24:00</option>
									    </select>
									    </div>
									</div>	
								</div>
								<div class="layui-form-item mag-bot-20">
									<div class="f-left">
										<div>会议结束是否通知运营人员</div><p class="color-nine">可以决定在每个会议结束之后是否告知运营人员该会议状态</p>
									</div>
									<div class="f-right">
										<div class="layui-input-inline" style="width:60px">
									      <input type="checkbox" name="switch" th:if="${set.noticePeople}" id="noticePeople" name="noticePeople" lay-skin="switch" checked="checked">
									      <input type="checkbox" name="switch" th:if="${!set.noticePeople}" id="noticePeople" name="noticePeople" lay-skin="switch">
									    </div>
									</div>	  								  
							    </div>
							    <div class="layui-form-item mag-bot-20">
									<button class="layui-btn layui-btn-normal btn-bg" lay-submit lay-filter="formEmployee" id="submit-btn">提交</button>
							    </div>
							</div>
						</form>
					</div>
				</div>
</body>
<script>
$(function(){
	setHeight()
	layui.use(['element','layer','form'], function(){
		var form = layui.form;
		
		//监听提交
		  form.on('submit(formEmployee)', function(data){
			  $.post($("#defaultForm").attr('action'), data.field, function(result) {
					window.parent.layer.msg(result.msg);
					closeLayer();
				}, 'json');
				return false;
		  });
	})
	//数值的加减按钮
	$(".layui-form .counterBox").on("click","span",function(){
		var val=$(this).siblings("input").val(),index=$(this).index();
		console.log(index,"pp")
		if(index==2){
			val++
		}else{
			val<=0? val=0:val--;
		}
		$(this).siblings("input").val(val)
	})
})

function setHeight(){
    var h = document.body.clientHeight;
    window.parent.setiframeWrap(h);
    
}
</script>
</html>